package com.cqrt.mapper;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigInteger;
import java.util.List;

@Mapper
public interface RTOutRuleMapper {

    @Deprecated
    @Select("select boid from ty_pj_jobdeliverlink where outputruleoid= TO_NUMBER(#{oid})")
    List<BigInteger> selectRemoteObjById(String oid);

    @Deprecated
    void batchUpdateMarkForDelete(@Param("oidList")List<BigInteger> remoteObjs);

    List<BigInteger> selectAllTypeById(String ruletypeOid);

    BigInteger selectJobOidByRuleOid(String ruleOid);
    //查询显示名称对应的规则Oid
    BigInteger selectOidByDisplayName(String displayName);
    //查询枚举对象对应的规则Oid
    List<BigInteger> selectOidByName(String name);
    //查询枚举对象对应的规则Oid
    List<BigInteger> selectOidByNameEnum(String nameEnumOid);

    //根据交付物规则Oid查询对应的JobOid
    BigInteger selectJobOidByOutRuleOid(String outRuleOid);
    //是否是手动创建的交付物规则
    BigInteger selectOutRuleIsNew(String ruleOid);
    //删除过去的通过状态
    void batchDeleteIBAAttrForIntegerWithOid(BigInteger jobOid);
    //通过JobOid查找项目Oid
    List<BigInteger> selectProjectOidByJobOid(String jobOid);

    //根据交付物规则Oid查询对应的交付物Oid
    List<BigInteger> selectDeliverOidByOutRuleOid(String outRuleOid);

    //根据交付物Oid查询对应的交付物是否为已生效状态
    String selectIsDeliverCompleted(BigInteger deliverOid);


    //查询JobOid查询对应的交付物规则Oid
    List<BigInteger> selectOutRuleOidByJobOid(String jobOid);

    //查询任务是否有交付状态

    List<BigInteger> selectIsHasDeliverRule(@Param("jobOid") BigInteger jobOid, @Param("attrdefOid") BigInteger attrdefOid);
    //查询交付规则是否有交付物
    List<BigInteger> selectIsHasDeliverObj(String outRuleOid);

    //通过子任务Oid查询父任务Oid
    BigInteger selectJobOidBySubJobOid(String jobOid);

    //通过交付规则Oid查询交付规则名
    String selectNameByOutRuleOid(String outRuleOid);

    //通过交付规则名和JOBOid查询交付规则Oid
    BigInteger selectOutRuleOidByJobOidAndName(@Param("jobOid") String jobOid, @Param("name") String name);

    //通过活动id查询任务Oid
    List<BigInteger> selectJobOidByActivityId(String activityId);

    //返回交付规则类型中文名称
    String selectRuleTypeDisplayName(String name);

    //通过交付物Oid和JobOid删除交付物与任务的关联
    void deleteJobDeliverLink(@Param("jobOid") String jobOid, @Param("deliverOid") String deliverOid);

    void deleteOutRuleDeliverLink(@Param("deliverOidList")List<BigInteger> deliverOidList);


    //通过规则id和交付物id删除交付物规则
    void deleteOutRuleDeliver(@Param("ruleOid") String ruleOid, @Param("linkOid") String linkOid);
    //通过交付物Oid删除交付物与交付规则的关联
    void deleteDeliverLink( @Param("deliverOid") String deliverOid);

    String selectOutRuleParentTypeIdByTypeId(@Param("typeId")String typeId);

    String selectIsKnow(String jobOid, String deliverOid);

    void updateJobKnow(String in, String knowpush);
}
